<?php require_once("./includes/session.php"); ?>
<?php require_once("./includes/open_connection.php"); ?>
<?php require_once("./includes/functions.php"); ?>
<?php
	confirm_login();
	
	if(isset($_GET['subj']))
	{
		$sel_subj = $_GET['subj'];
		$sel_page = "";
	}
	else if(isset($_GET['page']))
	{
		$sel_subj = "";
		$sel_page = $_GET['page'];
	}
	else 
	{
		$sel_subj = "";
		$sel_page = "";
	}
?>
<?php include("./includes/header.php"); ?>

<script>

</script>
<table id="structure">
    <tr>
       	<h1 id="header">CMS</h1>
    </tr>
	<tr>
		<td id="navigation">
			<ul class="subjects">
				<?php	// use the database connection here
					$subjects = get_all_subjects();
					
					while($subject = mysql_fetch_array($subjects))
					{
						echo "<li";
						if($subject["id"] == $sel_subj)
						{
							echo " class=\"selected\"";
						}
						echo "><a href=\"content.php?subj=" . urlencode($subject['id']) .
									"\">{$subject["menu_name"]}</a></li>";
						
						echo "</ul>";
					}
				?>
			</ul>
		</td>
		<td id="page">
			<h1 class="header">Credit Management System (CMS) </h1>
			<h3> Welcome <?php echo $_SESSION['username'] ?></h3>
			<ul>
				<li><a href="content.php">View Account Info</a></li>
				<li><a href="new_user.php">Add Staff User</a></li>
				<li><a href="logout.php" id="logout">Logout</a></li>
			</ul>
		</td>
	</tr>
</table>
<?php include("./includes/footer.php"); ?>	